package com.hongdee.crm.task.dao;

import com.hongdee.base.basedao.IBaseDao;
import com.hongdee.crm.task.entity.TCrmTask;
import com.hongdee.crm.task.entity.TCrmTaskReal;

import java.util.List;
import java.util.Map;

/**
 * 名  称:ITCrmTaskDao
 * 类  型: interface
 * 描  述: 任务生成相关sql操作
 * 路  径:com.hongdee.crm.task.dao
 * 作  者:liuze
 * 日  期:2017/2/28 10:22
 */
public interface ITCrmTaskDao extends IBaseDao {

    public Integer beforDays(String companyId,String pcode,String code) throws Exception;
    public List<Map<String,Object>> beforDays(String pcode, String code) throws Exception;

    public List<Map<String,Object>> guanaishengri(String companyId, int beforDays,int start,int limit,String pcode,String code) throws Exception;

    public List<Map<String,Object>> guanAiZhiBao(String companyId,int beforDays,int start,int limit,String pcode,String code) throws Exception;

    public List<Map<String,Object>> guanAiYanBao(String companyId,int beforDays,int start,int limit,String pcode,String code) throws Exception;

    /**
     *
     * @param company_id
     * @param type
     * @param beforeDay
     * @param start
     * @param limit
     * @param typePcode
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> liuShi(String company_id,int type,int beforeDay,int start,int limit,String typePcode) throws  Exception;

    /**
     *
     * @param company_id
     * @param type
     * @param beforeDay
     * @param start
     * @param limit
     * @param typePCode
     * @return
     * @throws Exception
     */
    public List<Map<String, Object>> liuShiIsEmpty(String company_id, int type,int beforeDay,int start,int limit,String typePCode) throws Exception;

    public String liuShiTxrq(String plate_num,int type,String companyId) throws Exception ;

    public List<Map<String,Object>> pageForCars(String company_id,int start,int limit,String typePcode,String typecode) throws Exception;
    public List<Map<String,Object>> nianShenPageForCars(String startTime,String endTime,String companyId,int start,int limit) throws Exception;

    public List<Map<String,Object>> baoxian(String company_id,int adv,String basetype,int type,String typePcode,String typeCode) throws Exception;

    public List<Map<String,Object>> baoXianHuoYue(String company_id,int bfd,String pcode,String code)throws  Exception;

    public List<Map<String,Object>> baoXianFeiHuoYue(String company_id,int bfd,String pcode,String code)throws  Exception;

    /**
     * 检测公司的任务是否慧
     * @param companyId
     * @param vin
     * @param carId
     * @param pcode
     * @param code
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> findTaskByCarIdAndVin(String companyId,String vin,String carId,String pcode,String code)throws Exception;

    public List<Map<String,Object>> findTasks(String companyId,String carId,String pcode,String code,String expectDate)throws Exception;
    public String liuShiRq(String company_id,String plat_num) throws  Exception;




    public Map query(String start,String limit,String cid,String pcode,String code,String status,String pdsql) throws  Exception;

    public List<Map<String,Object>> findRoleByUid(String uid) throws  Exception;

    public Map<String,String> findCodeByRId(String company_id,String rid,String type) throws  Exception;

    public Integer carBackToFacTask(String sqlStr,List<Object> params) throws Exception;

    public List<Map<String,Object>> findTaskByComapnyId(String companyId,int start,int limit)throws Exception;

    public List<Map<String,Object>> findRoleTypeByRoleId(String roleId,String companyId)throws Exception;

    /**
     * 根据主键查询任务信息
     * @param id
     * @return
     * @throws Exception
     */
    public TCrmTask findTaskById(String id)throws Exception;

    /**
     * 批量更新任务
     * @param list
     * @throws Exception
     */
    public void updateEntiry(List<TCrmTask> list) throws Exception;

    /**
     * 任务预生成 查询任务临时表信息
     * @param start
     * @param limit
     * @param sql
     * @param paramlist
     * @return
     * @throws Exception
     */
    public Map<String,Object> findTransferTaskList(String start,String limit,String sql,List<Object> paramlist) throws Exception;

    /**
     * 批量更新任务SAID
     * @param lists
     */
    public void updBatchCrmTaskSaId(final List<TCrmTask> lists);

    /**
     * 根据公司ID 清除公司下的任务信息
     * @param companyId
     * @throws Exception
     */
    public void cleanTask(String companyId) throws Exception;

    /**
     * 检测任务是否存在
     * @param companyId
     * @param carId
     * @param code
     * @param pCode
     * @param expectDate
     * @return
     * @throws Exception
     */

    public boolean checkSbTask(String companyId,String carId,String code,String pCode,String expectDate) throws Exception;
    public boolean checkTaskByVinAndId(String companyId,String vin,String carId,String code,String pCode,String expectDate) throws Exception;
    public List<Map<String, Object>> findTasksByVin(String companyId, String vin, String pcode, String code, String expectDate) throws Exception;

    /**
     * 检测券卡类任务是否存在
     * @param companyId
     * @param carId
     * @param code
     * @param pCode
     * @param expectDate
     * @param content
     * @return
     * @throws Exception
     */
    public boolean checkcouponTask(String companyId,String carId,String code,String pCode,String expectDate,String content) throws Exception;

    /**
     * 流失类任务 检测此类任务是否已经存在
     * @param companyId
     * @param carId
     * @param code
     * @param pCode
     * @return
     * @throws Exception
     */
    public boolean checkLsTask(String companyId,String carId,String code,String pCode)throws Exception;

    /**
     * 流失任务检测 改为vin
     * @param companyId
     * @param vin
     * @param code
     * @param pCode
     * @return
     * @throws Exception
     */
    public boolean checkLsTaskByVin(String companyId, String vin, String code, String pCode) throws Exception;
    /**
     * 流失六个月检测一个月以内如果有保养任务时不在生成流失任务
     * @return true 说明已经存在不允许在次添加 false说明不存在可以进行添加
     */
    public boolean checkLsByBYTask(String companyId,String carid,String code,String pCode,Long lxtxrq) throws Exception;

    /**
     * 获得指定用户的任务信息
     * @param sql
     * @return
     * @throws Exception
     */
    public Integer findTaskCount(String sql,String uid) throws Exception;

    /**
     * 根据用户ID 获得用户信息
     * @param uid
     * @return
     * @throws Exception
     */
    public Map<String,Object> findUserById(String uid) throws Exception;


    /**
     * 根据公司获得其公司下所有大类的数量信息
     * @param companyId
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> taskCountByPcode(String companyId)throws Exception;

    /**
     * 根据公司
     * @param companyId
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> taskCountByCode(String companyId)throws Exception;

    /**
     * 获得任务详细信息
     * @param taskId
     * @return
     * @throws Exception
     */
    public TCrmTaskReal getTaskRealById(String taskId) throws Exception;

    public TCrmTaskReal getTaskRealByTypdCode(String typePcode,String vin)throws Exception;

}



